CREATE TABLE  IF NOT EXISTS `__PREFIX__formdesign_form` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `admin_id` int(10) unsigned NOT NULL COMMENT '管理员ID',
  `form_name` varchar(255) NOT NULL DEFAULT '' COMMENT '表单名称',
  `form_desc` varchar(255) DEFAULT '' COMMENT '表单描述',
  `content` text COMMENT '表单模板',
  `content_data` text COMMENT '表单中的字段数据',
  `layout` varchar(30) DEFAULT '' COMMENT '布局方式',
  `fields` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '字段总数',
  `query` varchar(255) DEFAULT '' COMMENT '数据展示字段',
  `status` varchar(30) NOT NULL DEFAULT 'normal' COMMENT '状态',
  `createtime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  `updatetime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 COMMENT='表单模板表';

CREATE TABLE  IF NOT EXISTS `__PREFIX__formdesign_foreign` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `form_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '表单ID',
  `name` varchar(255) NOT NULL DEFAULT '' COMMENT '记录名称',
  `status` varchar(30) NOT NULL DEFAULT 'normal' COMMENT '状态',
  `createtime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  `updatetime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 COMMENT='表单记录表';

BEGIN;
ALTER TABLE `__PREFIX__formdesign_form` add `query` varchar(255)  DEFAULT '' COMMENT '数据展示字段';
ALTER TABLE `__PREFIX__formdesign_form` add `admin_id` int(10)unsigned NOT NULL COMMENT '管理员ID';
COMMIT;